-- disappear
-- created by xinj
-- 自动消失

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 每回合触发
    trigger = function(who, prop, arg)
        local pos = who:getPos();
        local grid = DungeonM.getGridByPos(pos);
        local user = ME.user;

        local openRound = grid.openRound or 0;
        local curRound = CombatM.getRound();

        if openRound + tonumber(prop[3]) > curRound then
            return false;
        end

        -- 直接格子失效，对象死亡
        grid.changeState(GRID_STATE_DISABLE);
        who:setHp(0);
        who:die();

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
